<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core">
  <head>
  </head>
  <body>
    <f:metadata>
      <f:viewParam name="paginaCorrente" value="#{mainBean.segretario.segretariBean.paginaCorrente}"/>
    </f:metadata>
    
    <ui:composition template="/WEB-INF/templates/segretario.xhtml">
      <ui:define name="titoloSottoSezione">Gestione Segretari</ui:define>
      
      <ui:define name="contenuto">
        <h3>Segretari:</h3>
        
        <!-- Elenco dei docenti -->
        <ui:fragment rendered="#{mainBean.segretario.segretariBean.numeroSegretari > 0}">
          <ui:fragment rendered="#{mainBean.segretario.segretariBean.numeroPagine > 1}">
            <table class="plainText">
              <tr>
                <td>Pagine: </td>
                <ui:repeat value="#{mainBean.segretario.segretariBean.pagine}" var="numeroPagina">
                  <td>
                    <h:link outcome="/pages/segretario-segretari?faces-redirect=true&amp;paginaCorrente=#{numeroPagina}" value="#{numeroPagina}"
                     rendered="#{numeroPagina != mainBean.segretario.segretariBean.paginaCorrente}"/>
                  </td>
                </ui:repeat>
              </tr>
            </table>
          </ui:fragment>
          <table border="1" cellspacing="0" cellpadding="2" style="border-style: solid; border-color: #000000">
            <thead class="tableHeader">
              <tr>
                <th style="border-style: solid; border-color: #000000">Nome Utente</th>
                <th style="border-style: solid; border-color: #000000">Nome</th>
                <th style="border-style: solid; border-color: #000000">Cognome</th>
                <th style="border-style: solid; border-color: #000000"></th>
              </tr>
            </thead>
            <tbody>
              <ui:repeat value="#{mainBean.segretario.segretariBean.segretari}" var="segretarioBean" varStatus="info">
                <tr class="#{info.even ? 'tableRow1' : 'tableRow2'}">
                  <td style="border-style: solid">#{segretarioBean.segretario.nomeUtente}</td>
                  <td style="border-style: solid">#{segretarioBean.segretario.nome}</td>
                  <td style="border-style: solid">#{segretarioBean.segretario.cognome}</td>
                  <td style="border-style: solid">
                    <h:form>
                      <h:commandLink value="Vedi dettagli o modifica" action="#{segretarioBean.vedi}"/>
                    </h:form>
                  </td>
                </tr>
              </ui:repeat>
            </tbody>
          </table>
        </ui:fragment>
        
        <h:form><h:commandButton value="Crea un nuovo segretario" action="#{mainBean.segretario.segretariBean.goToCreaSegretario}" class="plainText"/></h:form>
        <h3>
          <h:outputText rendered="#{mainBean.segretario.segretariBean.numeroSegretari == 0}" value="Nessun segretario da visualizzare"/>
        </h3> 
      </ui:define>
    </ui:composition>
  </body>
</html>